package homework;

import sun.security.krb5.internal.PAData;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

/**
 * @classname:demo06
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/10 11:59
 * @version: 0.1
 * @since:1.8
 */
public class demo06 {
    private static final String PATTERN = "yyyy-MM-dd HH-mm-ss";
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个时间/yyyy-MM-dd HH-mm-ss");
        String timeStr = input.nextLine();
        System.out.println("请输入间隔天数");
        int day = input.nextInt();
        LocalDateTime localDateTime = newDay(timeStr, day);
        System.out.println(localDateTime);
    }

private static final    DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(PATTERN);
    private static LocalDateTime newDay(String timeStr,int day) {
        LocalDateTime parse = LocalDateTime.parse(timeStr,FORMATTER);
        parse = parse.plusDays(day);
        return parse;
    }
}
